import { defHttp } from '@/utils/http';
import { mallShop } from '../apiRoot';
import type { IResData } from '../indexTypes';
import type { ProductItem, QueryShopMemberPopResult } from './types';

const Api = {
  shopLevelProductPageApi: mallShop + 'member/shopLevelProductPage',
  shopLevelProductListApi: mallShop + 'member/shopLevelProductList',
  queryShopMemberPopApi: mallShop + 'member/queryShopMemberPop'
};

/**
 * @description 会员福利中心列表
 * @date 11/01/2024
 * @export
 * @param {IResData} data
 */
export function shopLevelProductPage(data: IResData) {
  return defHttp.get({
    url: Api.shopLevelProductPageApi,
    data
  });
}

/**
 * @description 获取会员福利商品列表
 * @date 21/11/2023
 * @export
 * @param {{ keyWord: string }} data
 */
export function shopLevelProductList(data: { keyWord: string, levelDataId?: number }) {
  return defHttp.get<IResData<ProductItem>>({
    url: Api.shopLevelProductListApi,
    data
  });
}

/**
 * @description 获取首页的广告弹窗
 * @date 12/01/2024
 * @export
 */
export function queryShopMemberPop() {
  return defHttp.post<QueryShopMemberPopResult>({
    url: Api.queryShopMemberPopApi
  });
}